define([],function(){
    var tpl = {};
    /* 基本信息 */
    tpl.basicInfo = function(){
        var html = '';
        html += basicInfo();
        return html;
    };
    var basicInfo = function(){
        return '<script type="text/html" id="basicInfo-tpl">'+
                    '<li>' +
                        '<span class="title">'+
                            '{{if gender == "F"}}'+
                            '   <img src="page/followup/imgs/comm/girl.png" alt=""/>'+
                            '{{else}}'+
                            '   <img src="page/followup/imgs/comm/boy.png" alt=""/>'+
                            '{{/if}}'+
                        '</span>' +
                        '姓名：{{userName}}</li>'+
                    '<li>电话：{{phoneNo}}</li>'+
                '{{if testTime}}'+
                    '<li>测试日期：{{testTime}}</li>'+
                '{{/if}}'+
                '</script>'
    };
    /*  调查表  */
    tpl.surveyResult = function(){
        var html = '';
        html += surveyResult();
        return html;
    };
    var surveyResult = function(){
        return '<script type="text/html" id="surveyResult-tpl">'+
                    '<div class="box">'+
                        '<div class="item-title">妇女健康调查表 <span class="pull-right toDetail" testTime="{{testTime}}" userId="{{userId}}" userName="{{userName}}" gender="{{gender}}" score="{{answer}}" tel="{{phoneNo}}">查看详情</span></div>'+
                            '<ul class="item-list">'+
                                '<li><div class="ques-title">基础问卷</div></li>'+
                                '<li>'+
                                    '<div class="ques-title">职业紧张压力问卷</div>'+
                                    '<div class="clearfix ques-details">'+
                                        '<div class="clearfix item">'+
                                            '<span>#1</span>'+
                                            '<span>{{if total1>=0}}{{total1}}分{{else}}-{{/if}}</span>'+
                                        '</div>'+
                                        '<div class="clearfix item">'+
                                            '<span>#2</span>'+
                                            '<span>{{if total2>=0}}{{total2}}分{{else}}-{{/if}}</span>'+
                                        '</div>'+
                                        '<div class="clearfix item">'+
                                            '<span>#3</span>'+
                                            '<span>{{if total3>=0}}{{total3}}分{{else}}-{{/if}}</span>'+
                                        '</div>'+
                                        '<div class="clearfix item">'+
                                            '<span>#4</span>'+
                                            '<span>{{if total4>=0}}{{total4}}分{{else}}-{{/if}}</span>'+
                                        '</div>'+
                                        '<div class="clearfix item">'+
                                            '<span>#5</span>'+
                                            '<span>{{if total5>=0}}{{total5}}分{{else}}-{{/if}}</span>'+
                                        '</div>'+
                                        '<div class="clearfix item">'+
                                            '<span>#6</span>'+
                                            '<span>{{if total6>=0}}{{total6}}分{{else}}-{{/if}}</span>'+
                                        '</div>'+
                                        '<div class="clearfix item">'+
                                            '<span>#7</span>'+
                                            '<span>{{if total7>=0}}{{total7}}分{{else}}-{{/if}}</span>'+
                                        '</div>'+
                                        '<div class="clearfix item">'+
                                            '<span>Σ</span>'+
                                            '<span>{{if total>=0}}{{total}}分{{else}}-{{/if}}</span>'+
                                        '</div>'+
                                    '</div>'+
                                '</li>'+
                        '</ul>'+
                    '</div>'+
                '</script>'
    };
    /*
    * 生活事件：
    * */
    tpl.les = function(){
        var html = '';
        html += les();
        return html;
    };
    var les = function(){
        return '<script type="text/html" id="les-tpl">'+
                    '<div class="item-title">生活事件量表 <span class="pull-right toDetail" type="{{type}}" tel="{{phoneNo}}" testTime="{{testTime}}" userId="{{userId}}" userName="{{userName}}" gender="{{gender}}" score="{{answerResult}}">查看详情</span></div>'+
                    '<ul class="item-list">'+
                        '<li>'+
                            '<div class="ques-title">生活事件量表</div>'+
                            '<div class="clearfix ques-details">'+
                                '<div class="clearfix item">'+
                                    '<span>正性事件</span>'+
                                    '<span>{{if scoreMain>=0}}{{scoreMain}}分 {{else}}-{{/if}}</span>'+
                                '</div>'+
                                '<div class="clearfix item">'+
                                    '<span>负性事件</span>'+
                                    '<span>{{if scoreLoss>=0}}{{scoreLoss}}分{{else}}-{{/if}}</span>'+
                                '</div>'+
                                '<div class="clearfix item">'+
                                    '<span>总分</span>'+
                                    '<span>{{if scoreTitle>=0}}{{scoreTitle}}分{{else}}-{{/if}}</span>'+
                                '</div>'+
                            '</div>'+
                        '</li>'+
                    '</ul>'+
                '</script>'
    };
    /* 右侧 -- 答题模块  */
    tpl.questionsItem = function(){
        var html = '';
        html += questionsItem();
        return html;
    };
    var questionsItem = function(){
        return '<script type="text/html" id="questionsItem-tpl">'+
            '{{each data as value,i}}'+
                '<li {{if i==0}}class="checked"{{/if}} {{if value.initId }} initid = "{{value.initId}}" {{/if}} {{if value.group}}group="{{value.group}}"{{/if}}>{{value.title}}</li>'+
            '{{/each}}'+
            '</script>'
    };
    /*
    * LES
    * */
    /*  左侧 -- 题目列表  */
    tpl.questionsLes = function(){
        var html = '';
        html += questionsLes();
        return html;
    };
    var questionsLes = function(){
        return '<script type="text/html" id="questionsLes-tpl">'+
                '<div class="panel-heading" id="{{id}}" initId = "{{initId}}">{{itemTitle}}</div>'+
                '<div class="panel-body p-0-5 ques_les">'+
                    '<ul class="ques-list">'+
                        '{{if title}}<li class="clearfix titles" >{{title}}</li>{{/if}}'+
                        '{{each questions as ques,i}}'+
                        '{{if i<5}}'+
                        '<li class="clearfix">'+
                            '<div class="ques-con">{{ques.name}}&nbsp;&nbsp;{{ques.value}}</div>'+
                            '<div class="ques-mark" fuId="{{ques.fuId}}" selfId="{{ques.id}}" name="{{ques.name}}">查看备注</div>'+
                        '</li>'+
                        '{{/if}}'+
                        '{{/each}}'+
                    '</ul>'+
                '</div>'+

            '</script>'
    };
    /*  弹窗  */
    tpl.modalMark = function(){
        var html = '';
        html += modalMark();
        return html;
    };
    var modalMark = function(){
        return '<script type="text/html" id="modalMark-tpl">'+
                    '<div class="modal fade" tabindex="-1" role="dialog" id="myModal">'+
                        '<div class="modal-dialog" role="document">'+
                            '<div class="modal-content">'+
                                '<div class="modal-header">'+
                                    '<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+
                                    '<h4 class="modal-title">{{title}}</h4>'+
                                '</div>'+
                                '<div class="modal-body">'+
                                    '<ul class="mark-list">'+
                                    '{{each mark as value,i}}'+
                                    '<li>'+
                                        '<div class="mark-title">备注{{i+1}}：</div>'+
                                        '<div class="mark-con">{{ if value.text}}{{value.text}}{{else}}无{{/if}}</div>'+
                                    '</li>'+
                                    '{{/each}}'+
                                    '</ul>'+
                                '</div>'+
                            '</div>'+
                        '</div>'+
                    '</div>'+
                '</script>'
    };
    return tpl;
});